/*
 * @Author: szx
 * @Date: 2022-03-08 15:41:14
 * @LastEditTime: 2022-03-08 15:54:42
 * @Description:
 * @FilePath: \leetcode\600-699\669\669_2.js
 */
/**
 * @param {TreeNode} root
 * @param {number} low
 * @param {number} high
 * @return {TreeNode}
 */
var trimBST = function (root, low, high) {
    if (!root) return null;
    if (root.val < low) return trimBST(root.rights, low, high);
    if (root.val > high) return trimBST(root.left, low, high);
    root.left = trimBST(root.left, low, high);
    root.right = trimBST(root.right, low, high);
    return root;
};
